package com.unswift.window.listener;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import com.unswift.QuickApplication;
import com.unswift.window.factory.MessageFactory;

public class MainWindowListener extends WindowAdapter{

	@Override
	public void windowClosing(WindowEvent e) {
		if(!QuickApplication.isAllowClose()){
			int ok=MessageFactory.confirm(QuickApplication.getWindow(), "关闭当前窗口，未保存的工作可能会丢失，确认要关闭码？");
			if(ok==0){
				saveWork();
				System.exit(0);
			}
		}else{
			saveWork();
			System.exit(0);
		}
		super.windowClosing(e);
	}
	
	private void saveWork(){
		
	}
}
